from tortoise import BaseDBAsyncClient


async def upgrade(db: BaseDBAsyncClient) -> str:
    return """
        CREATE TABLE IF NOT EXISTS `medicinedetail` (
    `s_id` VARCHAR(255) NOT NULL  PRIMARY KEY COMMENT '表主键s_id',
    `g_id` VARCHAR(255) NOT NULL  COMMENT 'g_id',
    `specification` LONGTEXT NOT NULL  COMMENT '规格',
    `model` LONGTEXT NOT NULL  COMMENT '型号',
    `unit` VARCHAR(255) NOT NULL  COMMENT '计量单位',
    `material_quality` VARCHAR(255) NOT NULL  COMMENT '材质',
    `class_name` LONGTEXT NOT NULL  COMMENT '分类名称',
    `pack_unit` VARCHAR(255) NOT NULL  COMMENT '包装单位',
    `is_sterilization` VARCHAR(255) NOT NULL  COMMENT '是否灭菌'
) CHARACTER SET utf8mb4 COMMENT='详细信息';
CREATE TABLE IF NOT EXISTS `medicineinfo` (
    `id` VARCHAR(200) NOT NULL  PRIMARY KEY COMMENT '表主键',
    `procure_id` VARCHAR(255) NOT NULL  COMMENT '商品代码',
    `produce_name` LONGTEXT NOT NULL  COMMENT '单件商品名称',
    `reg_code` LONGTEXT NOT NULL  COMMENT '注册备案编号',
    `reg_produce_name` LONGTEXT NOT NULL  COMMENT '注册备案产品名称',
    `specification` LONGTEXT NOT NULL  COMMENT '规格',
    `model` LONGTEXT NOT NULL  COMMENT '型号',
    `produce_company_name` VARCHAR(255) NOT NULL  COMMENT '生产企业',
    `sc_declare_company_name` VARCHAR(255) NOT NULL  COMMENT '四川申报企业',
    `country_declare_company_name` VARCHAR(255) NOT NULL  COMMENT '国家申报企业',
    `purchase_class` VARCHAR(255) NOT NULL  COMMENT '分类采购类别',
    `relation_old_produce_code` VARCHAR(255) NOT NULL  COMMENT '关联老产品流水号',
    `last_month_average_price` VARCHAR(255) NOT NULL  COMMENT '截止上月末全省医疗机构采购加权平均价',
    `high_price` VARCHAR(255) NOT NULL  COMMENT '我省最高参考价',
    `linkage_reference_price` VARCHAR(255) NOT NULL  COMMENT '联动参考价',
    `year` VARCHAR(255) NOT NULL  COMMENT '年',
    `month` VARCHAR(255) NOT NULL  COMMENT '月'
) CHARACTER SET utf8mb4 COMMENT='基本信息';
CREATE TABLE IF NOT EXISTS `aerich` (
    `id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `version` VARCHAR(255) NOT NULL,
    `app` VARCHAR(100) NOT NULL,
    `content` JSON NOT NULL
) CHARACTER SET utf8mb4;"""


async def downgrade(db: BaseDBAsyncClient) -> str:
    return """
        """
